﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Admin.ViewModels.EventEditViewModel>" %>

<%@ Import Namespace="SDT.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Sự kiện
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Header" runat="server">
    Sửa sự kiện
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Toolbar" runat="server">
    <%= Html.Toolbar("Quay về", "/Event", "back") %>
    <%= Html.Toolbar("Xóa", "/Event/Delete/" + Model.Event.ID, "delete") %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if (ViewData["MessageInfo"] == null)
      { %>
    <% using (Html.BeginForm("Edit", "Event", FormMethod.Post, new { id = "adminForm", enctype = "multipart/form-data" }))
       {%>
    <%= Html.ValidationSummary(true)%>
    <div id="tabs">
    <ul>
		<li><a href="#tabs-1">Thông tin sự kiện</a></li>
		<li><a href="#tabs-2">Liên kết với chuyên mục bài viết</a></li>
	</ul>
	<div id="tabs-1">
    <table class="admintable" width="100%">
        <tbody>
            <tr>
                <td class="key">
                    Tên sự kiện (<font color="red">*</font>)
                </td>
                <td>
                    <%=Html.TextBoxFor(model => model.Event.Title, new { style = "width:795px;", @class="required" })%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Ảnh đại diện
                </td>
                <td>
                    <img class="represent" style="width:80px; padding:1px; border:1px solid #ccc" alt="<%= Model.Event.Title %>" src="<%= string.Format("{0}{1}", Model.ImageRootUrl,""+Model.Event.ID+"_"+ Model.Event.ImagePath) %>" />
                    <input type="file" name="ArticleImage" id="ArticleImage" />
                </td>
            </tr>
            
            <tr>
                <td class="key">
                    Trạng thái hiển thị
                </td>
                <td>
                    <%= Html.RadioButton("Event.PubYN", true, Model.Event.PubYN == true ? (new { @checked = "checked" }) : null)%>
                    Đăng tin
                    <%= Html.RadioButton("Event.PubYN", false, Model.Event.PubYN == false ? (new { @checked = "checked" }) : null)%>
                    Không đăng
                </td>
            </tr>
            <tr>
                <td class="key">
                    Đặt sự kiện trên trang chủ
                </td>
                <td>
                    <%= Html.RadioButton("Event.HomeYN", true, Model.Event.HomeYN == true ? (new { @checked = "checked" }) : null)%>
                    Đăng sự kiện trên trang chủ
                    <%= Html.RadioButton("Event.HomeYN", false, Model.Event.HomeYN == false ? (new { @checked = "checked" }) : null)%>
                    Không đăng sự kiện trên trang chủ
                </td>
            </tr>
            
            <tr>
                <td class="key">
                    Mô tả sự kiện
                </td>
                <td width>
                    <%=Html.TextAreaFor(m=>m.Event.Description, new { cols = 97, rows = 25 })%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    MetaDescription
                </td>
                <td>
                    <%=Html.TextBoxFor(model => model.Event.MetaDescription, new {style="width:795px" })%>
                </td>
            </tr>
                         <tr>
                <td class="key">
                    MetaKeyword
                </td>
                <td>
                    <%=Html.TextBoxFor(model => model.Event.MetaKeyword, new {style="width:795px" })%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    MetaTag
                </td>
                <td>
                    <%=Html.TextBoxFor(model => model.Event.MetaTag, new {style="width:795px" })%>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" value="Lưu lại" />
                    <input type="reset" value="Làm lại" />
                </td>
            </tr>
        </tbody>
    </table>
    </div>
    <div id="tabs-2">
        <ul style="margin:0;padding:0;list-style-type:none;">
		<% foreach( var item in Model.Categories) {
         var isSelect = item.EventArticleCategoryMaps.Where(e => e.EventID == Model.Event.ID).ToList().Count > 0 ? true : false;
              %>
			<li><%= Html.CheckBox("ArticleCategory." + item.ID, isSelect, new { value = item.ID, id = String.Format("ArticleCategory_{0}", item.ID) })%><%= item.Name %></li>
		<% } %>
		</ul>
    </div>
    </div>
    <%}
  } %>

    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate();
            $("#tabs").tabs();
        });       
        
        tinyMCE.init({
            mode: "exact",
            elements: "Event_Description",
            theme: "advanced",
            plugins: "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,paste,imagemanager",
            // Theme options
            theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
            theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
            theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
            theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            theme_advanced_statusbar_location: "bottom",
            paste_use_dialog: false,
            paste_auto_cleanup_on_paste: true,
            paste_convert_headers_to_strong: false,
            paste_strip_class_attributes: "all",
            paste_remove_spans: true,
            paste_remove_styles: true
        });
    </script>

</asp:Content>
